define([ELMP.resource('/utils/request.js', 'lib')],
  function (request) {
    return {
      namespace: 'attachment',
      upload(data) {
        return request({
          url: '/doc/v1/attachment/upload',
          method: 'post',
          contentType: false,
          processData: false,
          data
        })
      },
      download(id) {
        return request({
          url: `/doc/v1/attachment/download/${id}`,
          method: 'download'
        })
      },
      delete(params) {
        return request({
          url: '/doc/v1/attachment/delete',
          method: 'del',
          params
        })
      },
      list(data) {
        return request({
          url: ELMP.putUrl('/doc/v1/attachment/objects/list'),
          method: 'put',
          data
        })
      },
      // 根据文档id获取文档
      projList(data) {
        return request({
          url: '/proj/v1/attachment/objects/list',
          method: 'put',
          data
        })
      },
    }
  })
